package com.sce.core.entity;


import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import javax.validation.constraints.Size;



@Entity
@Table(name="t_user")
public class UserEntity extends BaseEntity{
	/**
	 * 
	 */
	private static final long serialVersionUID = 8470069039253670029L;

	@Column(name = "username",updatable = false,nullable = false)
	@Size(min = 0,max = 50)
	private String username;
	
	@Column(name = "password")
	@Size(min = 0,max = 100)
	private String password;
	
	@Column(name = "email")
	private String email;
	
	@Column(name = "mobile")
	private String mobile;
	
	@Column(name = "activated")
	private boolean activated;
	
	@Size(min = 0,max = 50)
	@Column(name = "activationkey")
	private String activationKey;
	
	@Size(min = 0,max = 50)
	@Column(name = "resetpasswordkey")
	private String resetPasswordKey;
	
	@ManyToMany(targetEntity = AuthorityEntity.class,fetch = FetchType.EAGER)																					
	@JoinTable(name= "t_user_authority",joinColumns = @JoinColumn(name="u_id"),inverseJoinColumns = @JoinColumn(name = "a_id"))
	private Set<AuthorityEntity> authorities;

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	public boolean isActivated() {
		return activated;
	}

	public void setActivated(boolean activated) {
		this.activated = activated;
	}

	public String getActivationKey() {
		return activationKey;
	}

	public void setActivationKey(String activationKey) {
		this.activationKey = activationKey;
	}

	public String getResetPasswordKey() {
		return resetPasswordKey;
	}

	public void setResetPasswordKey(String resetPasswordKey) {
		this.resetPasswordKey = resetPasswordKey;
	}

	public Set<AuthorityEntity> getAuthorities() {
		return authorities;
	}

	public void setAuthorities(Set<AuthorityEntity> authorities) {
		this.authorities = authorities;
	}
	
	
	
	
}
